<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>       
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="${_resources}/logo.png"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">                                            
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />  

<title>项目模板详细信息</title>
<%@ include file="/WEB-INF/jsp/common/inc.jsp" %>
<script type="text/javascript" src="${_resources}jquery-ui/jquery-ui-1.10.4.custom.min.js"></script>
<link rel="stylesheet" href="${_resources}jquery-ui/jquery-ui-1.10.4.custom.min.css" />
<script type="text/javascript">
var selectedList ="";
if('${docListjson}'!=''){
selectedList=JSON.parse('${docListjson}');	
}
//关闭弹出的页面
function shut(){
	parent.closeWin();
}
 
//点击文档名称查看文档内容
function checkFun(id){
	/* $("#popIframe").empty();	
	$("#popDiv").dialog({
		title:'查看文档模板信息',
		autoOpen: true,
		modal: true,
		position:'top',
		height: 500,
		width: 600
	});	
	$("#popIframe").attr("width","100%");
	$("#popIframe").attr("height","95%");
	$("#popIframe").attr("src","${_baseUrl}/documentTemplateController/checkDocumentTemplatePage?id="+id); */
	layerIndex =layer.open({
		  type: 2, 
		  title:'查看文档模板信息',
		  area: ['600px', '350px'],
		  fixed: false, //不固定
		  maxmin: true,
		  shim: true,
		  content: "${_baseUrl}/documentTemplateController/checkDocumentTemplatePage?id="+id+"&random="+Math.random()
		});
}


/* 关闭弹出框 */
function closeWin(){
	layer.close();
	//$("#popDiv").dialog('close');
}

function refreshTable(){
	menuList.bootstrapTable('refresh');
}
$(function(){
	selectDocumentTemplateList();
})
//根据项目类型选择项目模板
function selectDocumentTemplateList(){
	var projectType="${ProjectTypeId}";
	//$("#secretInvolvedLevelList").bootstrapTable('refresh', {url: '${_baseUrl}/projectTemplate/selectDocumentTemplateByProjectType' });
	if(projectType != null && projectType != "" && projectType != undefined){
		document.getElementById("kdDocument").style.display="none";
		document.getElementById("ktDocument").style.display="block";
		$("#secretInvolvedLevelList").bootstrapTable({
			url : '${_baseUrl}/KmProjectDocumentTemplateController/lookDocumentTemplateByProjectType?rand='+Math.random(),
			pagination: true,
			pageList: [5, 10, 20, 50],
	  		queryParams: queryParams,
	  		clickToSelect: true,
	        columns: [{
	            field: 'documentId',
	            title: 'documentId',
	            visible:false,
	            width: 5,
	        },
	        {
	            field: 'id',
	            title: 'id',
	            visible:false,
	            width: 5,
	        },{
	            field: 'documentName',
	            title: '文档模板名称',
	            width: 200,
	            formatter : function(value, row, index) {
	            	var str="";
	            		str +="<a onClick=\"checkFun('"+row.id+"');\"  title='"+value+"' class=\"late_on_temp\">"+value+"</a>";  
					return str;
				}
	        },{
	            field: 'templateSortKTs',
	            title: '模板类型',
	            width: 85 ,
	            formatter:function(value,row,index){
			           if(row.templateSortKTs.length > 0 && row.templateSortKTs[0].sortName != null ){
			                		var typeStr = "";
			                		for(var i = 0; i < row.templateSortKTs.length; i ++){
			                			if(row.templateSortKTs[i].sortName != null){
			                				typeStr += row.templateSortKTs[i].sortName+";";
			                			}
			                		}
			                		typeStr1 = typeStr.substring(0,typeStr.length-1);
			                		return typeStr1;
			            	}
			            }
	        },{
	            field: 'applicationScope',
	            title: '文档<br>适用范围',
	            width: 100,
	        },{
	            field: 'projectTypeName',
	            title: '项目类型',
	            width: 85,
	        },{
	            field: 'stageName',
	            title: '阶段名称',
	            width: 85,
	        }, {
	            field: 'stageId',
	            title: 'stageId',
	            visible:false,
	            width: 5,
	        }],
	    });
	}else{
		document.getElementById("ktDocument").style.display="none";
		document.getElementById("kdDocument").style.display="block";
	}
}
function queryParams(params){
	return {
	    pageSize: params.limit,
	    pageNo: params.pn,
	    sort : params.sort,
	    order : params.order,
	    id:"${id}"
   };
} 
</script>
</head>
<body>
 <div class="jbinformation roleshux">
	<table  class="table table-bordered submenu_table" style="width:100%">
  		<tr>
		    <td height="50" width="15%" align="center">模板名称</td>
		    <td width="35%" valign="middle">
		    	<div title="${projectTemplateType.projectTemplateName}" >${projectTemplateType.projectTemplateName}</div>
		    </td>
		    <td height="50" width="15%" align="center">适用范围</td>
		    <td width="35%" valign="middle">
		    	<div title="${projectTemplateType.applicationScope}">${projectTemplateType.applicationScope}</div>
		    </td>
  		</tr>
  		<tr>
  			<td height="50" width="15%" align="center">样式模板名称</td>
		    <td width="35%" valign="middle">
		      	<c:forEach items="${styleTemplateList}" var="styleTemplate">
		      	 <div title="${styleTemplate.styleDocumentName}">
					<c:if test="${styleTemplate.id==projectTemplateType.styleOutTemplate }">${styleTemplate.styleDocumentName} </c:if>
				 </div>
				</c:forEach>
		    </td>
		    <td height="50" width="15%" align="center">项目类型</td>
	        <td width="35%" valign="middle">
				<div class="">
	                <input type="text" class="nav_input" name="projectType" id="projectType" value="${ProjectType.name}" disabled="disabled">
	            </div>
	        </td>
  		</tr>
	</table>
</div>
<div class="wdang_s newz_popup newz_popup23" style="text-align: center;width:98%;margin:auto" id="kdDocument">
    <table class="table table-bordered table_inline">
        <thead>
          <tr>
           	<td width="10%">序号</td>	
            <td width="22%">文档模板名称</td>
            <td width="22%"><span >模板类型</span></td>
            <td width="22%"><span >适用范围</span></td>
            <td width="22%">文档模板来源</td>
          </tr>
         </thead>
          <c:forEach items="${projectTemplateList}" var="projectDocument"  varStatus="status">
			<tr <c:if test="${projectDocument.templateStatus =='0' }">style="color: #CACAC4;" </c:if>>	
				<td>${status.count}</td>
				<td>
					<a class="docModelName" href="javascript:;"  onclick="checkFun('${projectDocument.id}');"
						<c:if test="${projectDocument.templateStatus =='0' }">style="color: #CACAC4;" </c:if> title="${projectDocument.documentTemplateName }" >${projectDocument.documentTemplateName }</a>
				</td>
				<td>${projectDocument.documentType }</td>
				<td>${projectDocument.applicationScope }</td>
				<td>
					<c:if test="${projectDocument.source=='初始化'}">组织级文档模板</c:if>
					<c:if test="${projectDocument.source=='自定义'}">用户级文档模板</c:if>
					<c:if test="${projectDocument.source=='文档范本库'}">文档范本库</c:if>
				</td>
			</tr>
		</c:forEach>
    </table>  
</div>
<div style="overflow: auto; width:98%;margin: auto;" id="ktDocument">
<table id="secretInvolvedLevelList" class="table table-bordered table_inline"></table>
</div>                         
	<div id="popDiv" style="display: none;">
		<iframe id="popIframe" border="0" frameborder="0"></iframe>
	</div>



</body>
</html>